package com.gzsxy.esjy.service.statistical.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gzsxy.esjy.bus.entity.LoginLogQueryVo;
import com.gzsxy.esjy.bus.service.LoginlogService;
import com.gzsxy.esjy.service.base.dto.request.LoginLogRequest;
import com.gzsxy.esjy.service.base.dto.response.DefaultResponse;
import com.gzsxy.esjy.service.base.dto.response.PageResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 登录日志管理
 * @date 2022/5/4 11:51
 */
@CrossOrigin  //解决跨域
@RefreshScope    //动态刷新配置文件-外部配置文件
@RestController
@RequestMapping("/admin/loginLog")
@Api(description = "登录日志管理")
public class LoginLogController {

    @Autowired
    private LoginlogService loginlogService;

    @GetMapping("/list")
    @ApiOperation("登录日志")
    public DefaultResponse page(@ApiParam(value = "当前页面",required = true) @RequestParam Long page,
                                @ApiParam(value = "每页记录数",required = true) @RequestParam Long limit,
                                @ApiParam("查询对象") LoginLogQueryVo logQueryVo){
        IPage<LoginLogRequest> pageParam  = new Page<>(page, limit);
        PageResult<LoginLogRequest> list = loginlogService.getPageVo(pageParam,logQueryVo);
        return DefaultResponse.ok(list);
    }

}
